<!DOCTYPE html>
<?php
        session_start();
        if(count($_POST)){
            if($_POST["username"]=="abc"&&$_POST["upwd"]=="123"){
                $_SESSION["login_id"]=110;
            } else {
                echo "用户名或者密码错误！";    
            }
        }
        ?>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        if(isset($_SESSION["login_id"])){
        ?>
        你已经登录<br/>
        <a href="2.php">登出</a>
        <?php
        } else {
        ?>
        <h1>用户登录</h1>
        <form action="1.php"method="POST">
            用户名：<input type="text"name="username"/><br/>
            密码：<input type="password"name="upwd"/><br/>
            <input type="submit"name="登录">
        </form>
        <?php
        }
        ?>
    </body>
</html>
